<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Source Smoothing Example (k-Wave)</title>
	<link rel="stylesheet" href="kwavehelpstyle.css" type="text/css">
	<meta name="description" content="Source Smoothing Example.">
</head>

<body><div class="content">

<h1>Source Smoothing Example</h1>

<p>This example illustrates how spatial smoothing can be used to reduce discrete sampling artifacts.</p>

<p>
    <ul>
        <li><a href="matlab:edit([getkWavePath('examples') 'example_na_source_smoothing.m']);" target="_top">Open the file in the MATLAB Editor</a></li>
        <li><a href="matlab:run([getkWavePath('examples') 'example_na_source_smoothing']);" target="_top">Run the file in MATLAB</a></li>
    </ul>
</p>

<p>For a more detailed discussion of this example, see Treeby, B. E. and Cox, B. T., "A k-space Green's function solution for acoustic initial value problems in homogeneous media with power law absorption," <em>J. Acoust. Soc. Am.</em>, vol. 129, no. 6, pp. 3652-3660, 2011.</p>

<h2>Contents</h2>
<div>
	<ul>
		<li><a href="#heading2">Bandlimited interpolation</a></li>
		<li><a href="#heading3">Reducing visible oscillations via source smoothing</a></li>
	</ul>
</div>

<a name="heading2"></a>
<h2>Bandlimited interpolation</h2>

<p>When an initial pressure distribution with sharp gradients is used within k-Wave, oscillations that are not intuitively expected can appear in the numerical solution for the pressure field. The occurrence of these oscillations can be understood by considering the initial pressure distribution as the discrete sampling of a truncated Fourier series with a finite number of expansion coefficients (this continuous distribution is often called the band-limited interpolant). It is this band-limited interpolant that is propagated in Fourier space, thus when the function is discretely sampled at the grid nodes, oscillations can appear in the solution. This is illustrated below where the discrete pressure is shown with a stem plot and the band-limited interpolant overlaid with a solid line.</p>

<img vspace="5" hspace="5" src="images/example_na_source_smoothing_01.png" style="width:561px;height:420px;" alt="">

<p>Oscillations of this type are not unique to the solution method used in k-Wave. They are similarly encountered in other spectral methods in which the discretisation of the computational domain causes the corresponding Fourier space to become discrete and bounded (i.e., there is a finite number of spatial wavenumbers the computational grid can support).</p>  
    
<a name="heading3"></a>
<h2>Reducing visible oscillations via source smoothing</h2>
<p>The occurrence of oscillations is deterministic and intrinsic to the representation of the wavefield in a truncated Fourier basis. However, in some situations a practical method of reducing the visible oscillations may be desirable. For example, in many cases the discrete initial conditions represent an approximation to a continuous function for which the analogous pressure field does not contain any oscillations. The oscillations can be reduced by changing the characteristics of the band-limited interpolant by applying a window in the spatial frequency domain. This modifies the properties of the bounded Fourier space by forcing the expansion coefficients to decay. Selecting the most appropriate window requires a trade off between maintaining an acceptable main lobe width (which affects the amount of smoothing) whilst minimising the side lobe levels (which affects the observable oscillations). Note, the rectangular window is equivalent to the unwindowed case and produces the smallest possible main lobe width.</p>

<p>The figure below illustrates the initial pressure distribution, recorded time series, and the corresponding amplitude spectrum for the propagation of a spatial impulse in one dimension. The middle and lower panels show the same example with the initial pressure smoothed using frequency domain Hanning and Blackman windows, respectively. The magnitudes of the smoothed initial pressure distributions have been corrected by the corresponding coherent gain of the windows. The Blackman window has a lower side lobe level and thus the oscillations are less apparent. However, it also has a larger main lobe width and thus the spatial delta function appears more heavily smoothed. Both windows have high side-lobe roll-off rates so the oscillations decay quickly away from the peak. A large number of other variations are also possible by choosing from the families of existing window functions. For minimising oscillations, the Blackman family of windows is a good choice. This is the default window used by <code><a href="smooth.html">smooth</a></code> which is used by default on <code>source.p0</code> within the k-Wave simulation functions.</p>

<img vspace="5" hspace="5" src="images/example_na_source_smoothing_02.png" style="width:980px;height:840px;" alt="">

</div></body></html>